package test;

import java.util.List;

import javax.persistence.Column;

import org.junit.Test;

import cn.com.edu.nju.ecrec.dao.DaoFactory;
import cn.com.edu.nju.ecrec.dao.ItemDao;
import cn.com.edu.nju.ecrec.model.Item;
import cn.com.edu.nju.ecrec.util.DaoName;

public class testItem {

	@Test
	public void deleteById(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		id.deleteById(1);
	}
	
	@Test
	public void getids(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Long> list = id.getIds();
		for(long pid : list){
			System.out.println(pid);
		}
	}
	
	@Test
	public void getByUriName(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		Item i = id.getByUriName("kingsons-shock-proof-backpack-laptop-bag");
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
	}
	
	@Test
	public void getByBrand(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Item> list = id.getByBrand("Gucci");
		for(Item i: list){
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
		}
	}
	
	@Test
	public void getByCategory(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Item> list = id.getByCategory("Gucci Bags");
		for(Item i: list){
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
		}
	}
	
	@Test
	public void getByClassify(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Item> list = id.getByClassify("Purses");
		for(Item i: list){
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
		}
	}
	
	@Test
	public void getByGoodsPrice(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Item> list = id.getByGoodsPrice(30.99);
		for(Item i: list){
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
		}
	}
	
	@Test
	public void getByColor(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Item> list = id.getByColor("dark grey");
		for(Item i: list){
			System.out.println("pid:"+i.getPid()+" brand:"+i.getBrand()+" category:"+i.getCategory()+" classify:"+
					i.getClassify()+" uri_name:"+i.getUri_name()+" goods_price:"+i.getGoods_price()+" color:"+i.getColor());
		}
	}
	
	@Test
	public void getBrands(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<String> list = id.getBrands();
		for(String i: list){
			System.out.println(i);
		}
	}
	
	@Test
	public void getCategories(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<String> list = id.getCategories();
		for(String i: list){
			System.out.println(i);
		}
	}
	
	@Test
	public void getClassifies(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<String> list = id.getClassifies();
		for(String i: list){
			System.out.println(i);
		}
	}
	
	@Test
	public void getGoodsPrices(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<Double> list = id.getGoodsPrices();
		for(Double i: list){
			System.out.println(i);
		}
	}
	
	@Test
	public void getColors(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<String> list = id.getColors();
		for(String i: list){
			System.out.println(i);
		}
	}

	@Test
	public void getUriNames(){
		ItemDao id = DaoFactory.getInstance().getDao(DaoName.ITEM_DAO);
		List<String> list = id.getUriNames();
		for(String i: list){
			System.out.println(i);
		}
	}
}
